package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.DistrictMapper;
import com.ruoyi.business.domain.District;
import com.ruoyi.business.service.IDistrictService;

/**
 * 四级地域Service业务层处理
 *
 * @author MagicCube
 * @date 2023-05-04
 */
@Service
public class DistrictServiceImpl implements IDistrictService
{
    @Autowired
    private DistrictMapper districtMapper;

    /**
     * 查询四级地域
     *
     * @param id 四级地域主键
     * @return 四级地域
     */
    @Override
    public District selectDistrictById(Long id)
    {
        return districtMapper.selectDistrictById(id);
    }

    /**
     * 查询四级地域列表
     *
     * @param district 四级地域
     * @return 四级地域
     */
    @Override
    public List<District> selectDistrictList(District district)
    {
        return districtMapper.selectDistrictList(district);
    }

    /**
     * 新增四级地域
     *
     * @param district 四级地域
     * @return 结果
     */
    @Override
    public int insertDistrict(District district)
    {
        district.setCreateTime(DateUtils.getNowDate());
        return districtMapper.insertDistrict(district);
    }

    /**
     * 修改四级地域
     *
     * @param district 四级地域
     * @return 结果
     */
    @Override
    public int updateDistrict(District district)
    {
        district.setUpdateTime(DateUtils.getNowDate());
        return districtMapper.updateDistrict(district);
    }

    /**
     * 批量删除四级地域
     *
     * @param ids 需要删除的四级地域主键
     * @return 结果
     */
    @Override
    public int deleteDistrictByIds(Long[] ids)
    {
        return districtMapper.deleteDistrictByIds(ids);
    }

    /**
     * 删除四级地域信息
     *
     * @param id 四级地域主键
     * @return 结果
     */
    @Override
    public int deleteDistrictById(Long id)
    {
        return districtMapper.deleteDistrictById(id);
    }
}
